﻿@model ProductSpecificationAttributeModel

@{
    var parentModel = ViewData["Parent"] as ProductModel;
}

<datagrid id="specificationattributes-grid"
          allow-resize="true"
          allow-row-selection="true"
          allow-edit="true"
          allow-column-reordering="true"
          max-height="800px">
    <datasource read="@Url.Action("ProductSpecAttrList", new { productId = parentModel.Id })"
                delete="@Url.Action("ProductSpecAttrDelete")"
                update="@Url.Action("ProductSpecAttrUpdate")" />
    <paging position="Bottom" page-index="1" show-size-chooser="false" />
    <sorting>
        <sort by="DisplayOrder" />
    </sorting>
    <toolbar>
        <toolbar-group class="border-right-0">
            <button datagrid-action="DataGridToolAction.SaveChanges" type="button" class="btn btn-warning no-anims btn-flat">
                <i class="fa fa-check"></i>
                <span>@T("Admin.Common.SaveChanges")</span>
            </button>
            <button datagrid-action="DataGridToolAction.CancelEdit" type="button" class="btn btn-light btn-flat mr-auto">
                <span>@T("Common.Cancel")</span>
            </button>
        </toolbar-group>
        <zone name="datagrid_toolbar_alpha"></zone>
        <toolbar-group class="omega"></toolbar-group>
        <zone name="datagrid_toolbar_omega"></zone>
        <toolbar-group>
            <button datagrid-action="DataGridToolAction.DeleteSelectedRows" type="button" class="btn btn-danger no-anims btn-flat">
                <i class="far fa-trash-alt"></i>
                <span>@T("Admin.Common.Delete.Selected")</span>
            </button>
        </toolbar-group>
    </toolbar>
    <columns>
        <column for="SpecificationAttributeName" hideable="false" readonly="true" width="2fr" entity-member="SpecificationAttributeOption.SpecificationAttribute.Name" />
        <column for="SpecificationAttributeOptionName" width="1fr" entity-member="SpecificationAttributeOption.Name">
            <edit-template>
                <select name="SpecificationAttributeOptionId"
                        class="form-control d-block edit-control w-100"
                        data-editor="select"
                        v-bind:data-select-selected-id="item.row.SpecificationAttributeOptionId"
                        v-bind:data-select-init-text="item.row.SpecificationAttributeOptionName"
                        :data-select-url='item.row.SpecificationAttributeOptionsUrl'>
                </select>
            </edit-template>
        </column>
        <column for="AllowFiltering" halign="center" />
        <column for="ShowOnProductPage" halign="center" />
        <column for="DisplayOrder" halign="center" />
    </columns>
    <row-commands>
        <a datarow-action="DataRowAction.InlineEdit">@T("Common.Edit")</a>
        <a datarow-action="DataRowAction.Delete">@T("Common.Delete")</a>
    </row-commands>
</datagrid>